#include <angelscript.h>
#include <assert.h>
#include <IView.h>
#include <Kernel.h>

using namespace std;

 void viewtest()
{
	cout << "sampler view plugin : viewtest ..." << endl; 
}

class SamplerView : public IView
{
public:
    __declspec(dllexport) virtual ~SamplerView() {}

    __declspec(dllexport)  SamplerView()
	{
		;
	}

	__declspec(dllexport) virtual void config(asIScriptEngine *engine)
	{
		int r;
		r = engine->RegisterGlobalFunction("void viewtest()",asFUNCTION(viewtest),asCALL_CDECL); assert(r >= 0);
	}
    /// Get name of the graphics driver
    __declspec(dllexport) virtual const std::string &getName() const {
      static string sName("Sampler View Plugin");
      return sName;

    }
};

/// Retrieve the engine version we're going to expect
extern "C" __declspec(dllexport) int getVersion() {
  return 1;
}

/// Tells us to register our functionality to an engine kernel
extern "C" __declspec(dllexport) void registerPlugin(Kernel &K) {
  K.getViewManager().addView(
    auto_ptr<IView>(new SamplerView())
  );
}